<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<%@ include file="/commons/validation.jsp"%>
<%@ include file="/commons/dateTime.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="JavaScript" type="text/javascript" src="${ctx}/scripts/ajaxException.js"></script>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript" src="${ctx}/scripts/div/common.js"></script>
<script type="text/javascript">

	function selectPerson(){
	  var url = "${ctx}/common_employeeQuery.do?method=initSelectPsrsonMain&frameName=trackEditPage&callBack=selectPersonCallBack&multiple=true";
			top.windowOpen(url, "selectPerson", "", 530, 700);

	  }

	//回调，选人
	  function selectPersonCallBack(info){

	  var onePerson= new Array();

	  onePerson=info.split(";");

	    for (i=0;i<onePerson.length ;i++ )
	    {
	     var oneAttribute= new Array();
	     oneAttribute=onePerson[i].split(",");

	        var userId=oneAttribute[0];
	        var employeeName=oneAttribute[1];
	        var deptId=oneAttribute[2];
	        var dept=oneAttribute[3];

	        $("trackerId").value=userId;
			$("trackerName").value=employeeName;

	    }
	  }

	  function display(id,type){
	       if(type=='show'){
	       document.getElementById(id).style.display="";
	       document.getElementById(id).className="required validate-date";
	       }
	       if(type=='hide'){
	       document.getElementById(id).style.display="none";
	       document.getElementById(id).className="validate-date";
	       document.getElementById("completeDate").value="";

	       }
	   }

	   function init(){

			if(document.getElementById("completeYnOne").checked ==true){
				display('completeDate_Tr','show');
			}else{
			display('completeDate_Tr','hide');
			$("description_TD").className = "aux_intable_require_more";
			Validation.changeElmValidate("description","required  max-length-200");
			}
		}

	function editTrack(){
		var isPass=$('editForm').fireEvent("onSubmit");
		if(isPass){
			closeORopenButton();
			var param = Form.serialize('editForm');
			var url = '${ctx }/occupation_perfectItemRequisitionAction.do?method=editPerfectItemTrack';
			new Ajax.Request(url,{method: 'post' , parameters: param, onSuccess : function(response){
				closeORopenButton();
				ajaxSubmitException(response.responseText);
				findFrame('TrackPageFrame').refresh();
				windowClose();

			}});
		}
	}

	function closeORopenButton(){
		$('btn1_22').disabled= !$('btn1_22').disabled;
	}

	function yesComplete(hid){
		if(hid){
		$("description_TD").className = "aux_intable_require_more";
		Validation.changeElmValidate("description","required  max-length-200");

		}else{
			$("description_TD").className = "aux_intable_td2";
			Validation.changeElmValidate("description","max-length-200");
		}
	}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>整改项目-编辑</title>
</head>
<body onload="init();">
<form name="editForm" id="editForm" class="required-validate" action="">
<input type="hidden" name="perfectItemRequisitionId" id="perfectItemRequisitionId" value="${perfectItemRequisitionId }" />
<input type="hidden" name="keyword" id="keyword" value="${perfectItemTrackVO.keyword }" />
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td colspan="2" class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle" /> <span class="window_head_intext">登记跟进情况</span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td colspan="2" class="aux_header_line_2"></td>
  </tr>
  <tr>
    <td colspan="2" class="content"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td class="aux_outtable_color"><table width="100%" border="0" cellpadding="0" cellspacing="1" class="aux_intable_color">
           <tr>
            <td class="aux_intable_td1">跟进人：</td>
            <td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td>
                  <input type="hidden" name="trackerId" id="trackerId" value="${perfectItemTrackVO.trackerId }" />
                  <input name="trackerName" readonly="readonly" id="trackerName" type="text" class="inputtext required" value="${perfectItemTrackVO.trackerName }" size="16">
                  </td>
                  <td width="4">&nbsp;</td>
                  <td><a href="#"  onClick="javascript:selectPerson();" onFocus="this.blur()"><img src="${ctx}/images/ico_cz.gif" width="16" height="16" border="0" ></a></td>
                </tr>
            </table></td>
           </tr>
			<tr>
            <td class="aux_intable_td1">跟进时间：</td>
            <td class="aux_intable_require"><table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><input name="trackDate" id="trackDate" type="text" class="inputtext required validate-date-yyyy-mm-dd validate-ajax" validateUrl="${ctx }/occupation_perfectItemRequisitionAction.do?method=hasTrackDate&keyword=${perfectItemRequisitionId }" value="${perfectItemTrackVO.trackDate }" size="16" /></td>
                <td width="4">&nbsp;</td>
                <td><img src="${ctx}/images/ico_clock.gif" id="trackDateImg" width="20" height="20" /></td>
              </tr>
            </table></td>
            </tr>
          <tr>
		    <td valign="top" class="aux_intable_td1">是否完工：</td>
		    <td colspan="3" class="aux_intable_require">
		    <input name="completeYn" type="radio" id="completeYnOne" onClick="display('completeDate_Tr','show');yesComplete(false);" value="1" <c:if test="${perfectItemTrackVO.completeYn == '1' || perfectItemTrackVO.completeYn == null }">checked="checked"</c:if>   />
                                  是                   &nbsp;　&nbsp;　&nbsp;&nbsp;
            <input type="radio" name="completeYn" id="completeYnTwo" value="0" onClick="display('completeDate_Tr','hide');yesComplete(true); " <c:if test="${perfectItemTrackVO.completeYn == '0'  }">checked="checked"</c:if> />
                                  否</td>
		    </tr>
		 <tbody colspan="4" width="100%" border="0" cellpadding="0" cellspacing="1" id="table02" style="display:show">
		 <tr>
            <td valign="top" class="aux_intable_td1">跟进情况:</td>
            <td colspan="3" class="aux_intable_td2" id="description_TD"><textarea name="description" id="description" cols="26" rows="3" class="textareatext max-length-200">${perfectItemTrackVO.description }</textarea></td>
            </tr>
		  <tr id="completeDate_Tr">
            <td class="aux_intable_td1">完工日期:</td>
            <td colspan="3" class="aux_intable_require">
            <table border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td><input name="completeDate" id="completeDate" type="text" class="inputtext required validate-date-yyyy-mm-dd great-equals-than-trackDate" validateMessageGreatEquals="完工日期应大于等于跟进日期" value="${perfectItemTrackVO.completeDate }" size="16" /></td>
                <td width="4">&nbsp;</td>
                <td><img id="completeDateImg" src="${ctx}/images/ico_clock.gif" width="20" height="20" /></td>
              </tr>
            </table>
            </td>
            </tr>
			</tbody>

        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr>

    <td class="window_footer"><table border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_21"></td>
              <td class="buttonOffMiddle" id="btn1_22" onClick="javascript:editTrack();" onMouseOver="btn_change_over(2)" onMouseOut="btn_change_out(2)" onBlur="btn_change(2)"><img src="${ctx}/images/ico_ok.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 保 存</td>
              <td class="buttonOffRight" id="btn1_23"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onClick="javascript:windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)" onBlur="btn_change(3)"><img src="${ctx}/images/ico_cancel.gif" alt="" width="14" height="14" border="0" align="absbottom" /> 关 闭</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</form>
<script type="text/javascript">
     Calendar.setup(
      {
       inputField : "trackDate", // ID of the input field
       ifFormat : "%Y-%m-%d", // the date format
       button : "trackDateImg", // ID of the button
      // align          :    "Tl",           // alignment (defaults to "Bl")
 		singleClick    :    true
      }
      );

     Calendar.setup(
    	      {
    	       inputField : "completeDate", // ID of the input field
    	       ifFormat : "%Y-%m-%d", // the date format
    	       button : "completeDateImg", // ID of the button
    	      // align          :    "Tl",           // alignment (defaults to "Bl")
    	 		singleClick    :    true
    	      }
    	      );
     </script>
</body>
</html>